/***************************************************************************
* Lyrics-Player                                                            *
* Copyright (C) 2012 Andrey Derevyanko <derandr@gmail.com>                 *
*                                                                          *
* This program is free software: you can redistribute it and/or modify     *
* it under the terms of the GNU General Public License as published by     *
* the Free Software Foundation, either version 3 of the License, or        *
* (at your option) any later version.                                      *
*                                                                          *
* This program is distributed in the hope that it will be useful,          *
* but WITHOUT ANY WARRANTY; without even the implied warranty of           *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
* GNU General Public License for more details.                             *
*                                                                          *
* You should have received a copy of the GNU General Public License        *
* along with this program.  If not, see <http://www.gnu.org/licenses/>.    *
***************************************************************************/

/*! \file sharedStructures.h
 *  \brief Different structures that are used by several classes
 *  \author Andrey Derevyanko <derandr@gmail.com>
 *  \version 1.1
 *  \date 23/06/2012
 *  \copyright GNU Public License
 */

#ifndef SHAREDSTRUCTURES_H
#define SHAREDSTRUCTURES_H

#include <QString>
#include <QStringList>
#include <QSet>
#include <phonon/mediaobject.h>
#include <BackendCapabilities>

/*! \class lpVersion
 *  \brief Class provides static functions for SW component versions
 */
class lpVersion
{
public:
    /*! \fn QString phonon_version()
     *  \brief Phonon found version.
     */
    static QString phonon_version() {return QString(Phonon::phononVersion());}
    /*! \fn QString program_version()
     *  \brief Actual SW version.
     */
    static QString program_version() {return "0.3.1";}
    /*! \fn QString id3lib_version()
     *  \brief Used ID3 library version.
     */
    static QString id3lib_version() {return "3.8.3";}
    /*! \fn QString backend_version()
     *  \brief Backend capabilities. Returns string comtaining supported formats.
     */
    static QString backend_version()
    {
        //Phonon::MediaObject verMedia;
        QStringList mimeTypes = Phonon::BackendCapabilities::availableMimeTypes();
        QSet<QString> resSet;
        QString resString = QObject::tr("Found (");
        resSet.clear();
        foreach (QString item, mimeTypes)
        {
            if (item.contains("audio") && item.contains("mp3")) resSet.insert("mp3");
            if (item.contains("audio") && item.contains("wma")) resSet.insert("wma");
            if (item.contains("audio") && item.contains("ogg")) resSet.insert("ogg");
        }
        if (resSet.isEmpty())
            return QObject::tr("Not found");

        foreach (QString item, resSet)
        {
            resString += " " + item;
        }resString += " ).";
        return resString;
    }
};

//! Meta data structure.
/*! Structure contains the information fro dislpaying with the cover. */
struct trackMetaData_t
{
    QString m_filePath; /*!< File path. */
    QString m_artist; /*!< Artist. */
    QString m_title; /*!< Title. */
    QString m_album; /*!< Album. */
    QString m_year; /*!< Year. */
    QString m_genre; /*!< Genre. */
};

//! Player states enumeration
/*! Each enum member describes single player state. */
enum playState_t {
    st_Play, /*!< Playing. */
    st_Pause, /*!< Paused. */
    st_Stop /*!< Stopped. */
};


#endif // SHAREDSTRUCTURES_H
